poudre_points <- data.frame(name = c("Mishawaka", "Rustic", "Blue Lake Trailhead"),
long = c(-105.35634, -105.58159, -105.85563),
lat = c(40.68752, 40.69687, 40.57960))
poudre_points_sf <- st_as_sf(poudre_points, coords = c("long", "lat"), crs = 4326)
poudre_points_prj <- st_transform(poudre_points_sf, st_crs(counties))
st_crs(poudre_points_prj) == st_crs(counties)
## [1] TRUE
elevation <- rast(elevation)
names(elevation) <- "Elevation"
elevation_crop <- crop(elevation, ext(roads))
tm_shape(elevation, bbox = st_bbox(poudre_hwy))+
tm_raster(style = "cont", title = "Elevation (m)")+
tm_shape(poudre_hwy)+
tm_lines()+
tm_shape(poudre_points_prj)+
tm_dots(size = 0.2)
## stars object downsampled to 1142 by 876 cells. See tm_shape manual (argument raster.downsample)
counties3<-counties%>%
filter(NAME %in% c("Larimer", "Denver", "Pueblo"))
tm_shape(counties)+
tm_polygons(col = "ALAND")
tm_shape(counties)+
tm_polygons(col = "AWATER")
poudre_points_prj$elevation <- extract(elevation, vect(poudre_points_prj))$Elevation
poudre_points_prj %>%
ggplot() +
geom_bar(aes(x = name, y = elevation), stat = "identity")
There are 3 small segments of highway not attached to the main highway but have the same name.